home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-210.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  52.0 KB  |  1,345 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Sun, 08 Nov 92       Volume 1 : Issue 210
  2.  
  3. Today's Topics:
  4.  
  5.     Sound Manager
  6.  
  7.  
  8.  
  9. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  10.  
  11. The digest is a collection of article threads from the internet newsgroup
  12. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  13. regularly and want an archive of the discussions.  If you don't know what a
  14. newsgroup is, you probably don't have access to it.  Ask your systems
  15. administrator(s) for details.  (This means you can't post questions to the
  16. digest.)
  17.  
  18. Each issue of the digest contains one or more sets of articles (called
  19. threads), with each set corresponding to a 'discussion' of a particular
  20. subject.  The articles are not edited; all articles included in this digest
  21. are in their original posted form (as received by our news server at
  22. cs.uoregon.edu).  Article threads are not added to the digest until the last
  23. article added to the thread is at least one month old (this is to ensure that
  24. the thread is dead before adding it to the digest).  Article threads that
  25. consist of only one message are generally not included in the digest.
  26.  
  27. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  28. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  29. file /pub/mac/csmp-digest/README before downloading any files.  The most
  30. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  31. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  32. archive has a mail server; send a message with the text '$MACarch help' (no
  33. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  34.  
  35. The digest is also available via email.  Just send a note saying that you
  36. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  37. automatically receive each new issue as it is created.  Sorry, back issues
  38. are not available through the mailing list.
  39.  
  40. Send administrative mail to mkelly@cs.uoregon.edu.
  41.  
  42.  
  43. -------------------------------------------------------
  44.  
  45. From: edw@caligula.cts.com (Ed Watkeys)
  46. Subject: Sound Manager
  47. Date: 18 May 92 11:57:29 GMT
  48. Organization: Distant Software
  49.  
  50. Is there some trick to installing voices in a sampledSynth channel? I've been
  51. playing, and I can't seem to avoid a bus error. This is what I'm doing more
  52. or less:
  53.  
  54.     mySample = GetResource('snd ',19000);
  55.     if (mySample == NULL || ResErr)
  56.         ExitToShell;
  57.     
  58.     HLock(mySample);
  59.  
  60.     myCmd.cmd = soundCmd;
  61.     myCmd.param1 = 0;
  62.     myCmd.param2 = (long) *mySample;
  63.  
  64.     if (SndDoCommand(myChannel,&myCmd,false) <> noErr)
  65.         ExitToShell;
  66.  
  67.     myCmd.cmd = freqDurationCmd;
  68.     myCmd.param1 = 2000;
  69.     myCmd.param2 = 60;
  70.  
  71.     /* and I get a bus error in this line: */
  72.     if (SndDoCommand(myChannel,&myCmd,false) <> noErr)
  73.         ExitToShell;
  74.  
  75. What I'm doing is very simple, and a lot of my code is IM VI code translated
  76. into C. I have a channel open at this point, using IM VI sample code. If I
  77. change sampledSynth to the square wave synth and remove the code to install
  78. a voice, everything works fine.
  79.  
  80. Also, does anyone know if there are tech notes dealing with the Sound Manager?
  81. If so, are they post-IM VI, or do they cover information that was out into
  82. IM VI?
  83.  
  84. Thanks loads,
  85. Ed
  86.  
  87. - --
  88. Ed Watkeys (Drexel U. Comp Sci)  "Moral judgement and condemnation is
  89. edw@caligula.cts.com              the favorite form of revenge for the
  90. edw%caligula@phlpa.pha.pa.us      spiritually limited on those who are
  91. ls.com!phlpa!caligula!edw         less so...." -- Friedrich Nietzsche
  92.  
  93. +++++++++++++++++++++++++++
  94.  
  95. From: REEKES@applelink.apple.com (Jim Reekes)
  96. Date: 19 May 92 19:42:59 GMT
  97. Organization: Apple Computer, Inc.
  98.  
  99. In article <01050133.3q4v99@caligula.cts.com>, edw@caligula.cts.com (Ed Watkeys) writes:
  100. > Is there some trick to installing voices in a sampledSynth channel? I've been
  101. > playing, and I can't seem to avoid a bus error. This is what I'm doing more
  102. > or less:
  103. >     mySample = GetResource('snd ',19000);
  104. >     if (mySample == NULL || ResErr)
  105. >         ExitToShell;
  106. >     
  107. >     HLock(mySample);
  108. >     myCmd.cmd = soundCmd;
  109. >     myCmd.param1 = 0;
  110. >     myCmd.param2 = (long) *mySample;
  111. >     if (SndDoCommand(myChannel,&myCmd,false) <> noErr)
  112. >         ExitToShell;
  113. >     myCmd.cmd = freqDurationCmd;
  114. >     myCmd.param1 = 2000;
  115. >     myCmd.param2 = 60;
  116. >     /* and I get a bus error in this line: */
  117. >     if (SndDoCommand(myChannel,&myCmd,false) <> noErr)
  118. >         ExitToShell;
  119. > What I'm doing is very simple, and a lot of my code is IM VI code translated
  120. > into C. I have a channel open at this point, using IM VI sample code. If I
  121. > change sampledSynth to the square wave synth and remove the code to install
  122. > a voice, everything works fine.
  123. > Also, does anyone know if there are tech notes dealing with the Sound Manager?
  124. > If so, are they post-IM VI, or do they cover information that was out into
  125. > IM VI?
  126. > Thanks loads,
  127. > Ed
  128.  
  129. 1. You don't point at the 'snd ' resource for the soundCmd.  You pass a
  130. pointer to the sound header contained within the resource.
  131.  
  132. SoundApp demonstrates how to do all of this.  It's official MacDTS sample
  133. code.  It's been available for a few years.  Inside Mac VI is the only
  134. documentation to read.  The rest is covered in the sample code.
  135.  
  136.  
  137. - -----------------------------------------------------------------------
  138. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  139.                              |          Sound Manager Expert
  140. Apple Computer, Inc.         | "All opinions expressed are mine, and do
  141. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  142. Cupertino, CA 95014          |       employer, Apple Computer Inc."
  143.  
  144. +++++++++++++++++++++++++++
  145.  
  146. From: udsugar@mcs.drexel.edu (David Sugar)
  147. Date: 6 Jun 92 04:49:16 GMT
  148. Organization: Drexel University, Dept. of Math. and Comp. Sci.
  149.  
  150.  
  151.   I have what I hope is a farily simple question on using a Sound Manager
  152. call.  The call in question is SPBGetDeviceInfo.  I am having trouble when
  153. I use either the selector siActiveChannels or siActiveLevels.  I have
  154. read the little description in IM VI many time and I don't understand 
  155. what it means by "When setting the active channels, the data passed in
  156. is a long integer etc...  I keep getting the error back of -231.  But
  157. any of the other calls that I make with different selectors are ok. 
  158.   I have already opened the sound input device with no problem and have
  159. the refNum and I can get the number of channels and all that stuff, but
  160. not this ActiveChannels or ActiveLevels.  Here is what I have right now,
  161. keep in mind that I'm just doing some playing around with it right now, 
  162. I will be adding error checking etc in when I get the basic stuff to actually
  163. work.
  164.  
  165. void GetMiscInfo(long refNum)
  166. {
  167.     OSErr      err;
  168.     int      chav,chan,lmet,lmac;
  169.     long    chac;
  170.  
  171.    lmet=1;
  172.    chac=0x00000000;  /*???  I did this just becuase I wasn't sure what to do*/
  173.     err=SPBGetDeviceInfo(refNum,siChannelAvailable,(char) *)&chav); /*works*/
  174.     if (chav >=2)
  175.         chan=2;
  176.     else
  177.         chan=1;
  178.     err=SPBSetDeviceInfo(refNum,siNumberChannels,(char *)&chan); /*works*/
  179.     err=SPBSetDeviceInfo(refNum,siLevelMeterOnOff,(char *)&lmet); /*works*/
  180.     err=SPBSetDeviceInfo(refNum,siDeviceBufferInfo,(char *)&chac);  /* error */
  181.    err=SPBGetDeviceInfo(refNum,siActiveLevels,(char *)&lmac); /* error */
  182. }
  183.  
  184.   Of the 2 lines that get errors I have a feeling that the second one, the
  185. call to siActiveLevels is becuase the active channels wasn't set correctly
  186. in the previous call.  But, I'm not sure how to set the varialbe chac etc
  187. to get it to work..  
  188.   Does anyone have any idea on what I'm doing wrong??  
  189.  
  190.   Thanks
  191.  
  192.   Dave Sugar
  193.   udsugar@mcs.drexel.edu
  194.  
  195. +++++++++++++++++++++++++++
  196.  
  197. From: REEKES@applelink.apple.com (Jim Reekes)
  198. Date: 9 Jun 92 07:33:33 GMT
  199. Organization: Apple Computer, Inc.
  200.  
  201. In article <1992Jun6.044916.13034@mcs.drexel.edu>, udsugar@mcs.drexel.edu (David Sugar) writes:
  202. >   I have what I hope is a farily simple question on using a Sound Manager
  203. > call.  The call in question is SPBGetDeviceInfo.  I am having trouble when
  204. > I use either the selector siActiveChannels or siActiveLevels.  I have
  205. > read the little description in IM VI many time and I don't understand 
  206. > what it means by "When setting the active channels, the data passed in
  207. > is a long integer etc...  I keep getting the error back of -231.  But
  208. > any of the other calls that I make with different selectors are ok. 
  209. >   I have already opened the sound input device with no problem and have
  210. > the refNum and I can get the number of channels and all that stuff, but
  211. > not this ActiveChannels or ActiveLevels.  Here is what I have right now,
  212. > keep in mind that I'm just doing some playing around with it right now, 
  213. > I will be adding error checking etc in when I get the basic stuff to actually
  214. > work.
  215. > void GetMiscInfo(long refNum)
  216. > {
  217. >     OSErr      err;
  218. >     int      chav,chan,lmet,lmac;
  219. >     long    chac;
  220. >    lmet=1;
  221. >    chac=0x00000000;  /*???  I did this just becuase I wasn't sure what to do*/
  222. >     err=SPBGetDeviceInfo(refNum,siChannelAvailable,(char) *)&chav); /*works*/
  223. >     if (chav >=2)
  224. >         chan=2;
  225. >     else
  226. >         chan=1;
  227. >     err=SPBSetDeviceInfo(refNum,siNumberChannels,(char *)&chan); /*works*/
  228. >     err=SPBSetDeviceInfo(refNum,siLevelMeterOnOff,(char *)&lmet); /*works*/
  229. >     err=SPBSetDeviceInfo(refNum,siDeviceBufferInfo,(char *)&chac);  /* error */
  230. >    err=SPBGetDeviceInfo(refNum,siActiveLevels,(char *)&lmac); /* error */
  231. > }
  232. >   Of the 2 lines that get errors I have a feeling that the second one, the
  233. > call to siActiveLevels is becuase the active channels wasn't set correctly
  234. > in the previous call.  But, I'm not sure how to set the varialbe chac etc
  235. > to get it to work..  
  236. >   Does anyone have any idea on what I'm doing wrong??  
  237.  
  238. Never, never, EVER, pass a type int to the Mac toolbox.  In MPW the int
  239. is four bytes long, but in Think C they used to be two bytes.  With the
  240. new version of Think they can be either two or four bytes depending on
  241. your preferences.
  242.  
  243. The proper thing to pass each of these selectors are:
  244.  
  245. siChannelAvailable     short
  246. siNumberChannels       short
  247. siLevelMeterOnOff      short
  248. siDeviceBufferInfo     long
  249. siActiveLevels         long
  250.  
  251. The next thing is that error -231 means the selector is not supported,
  252. thus the name "siUnknownInfoType".
  253.  
  254. So, if you get the error it means it's not going to work with the current
  255. driver.  The Apple Sound Input driver does not support setting either
  256. siDeviceBufferInfo or siActiveLevels.
  257.  
  258. Below are some examples of calling SPBGetDeviceInfo and SPBSetDeviceInfo.
  259.  
  260.  
  261. long GetBufferLength(void)
  262. {
  263.     long       bufferLength;
  264.     OSErr       err;
  265.  
  266.     err = SPBGetDeviceInfo(gSndInputRef, siDeviceBufferInfo, (Ptr)&bufferLength);
  267.     if (err == noErr)                         // noErr
  268.         return (bufferLength);
  269.     else
  270.         return (0);
  271. }
  272.  
  273. short GetVoxStopData(void)
  274. {
  275.     short       VoxData[3];
  276.     OSErr       err;
  277.  
  278.     err = SPBGetDeviceInfo(gSndInputRef, siVoxStopInfo, (Ptr)VoxData);
  279.     if ( (err == noErr) && (VoxData[0]) )           // noErr and Vox Stop is on 
  280.         return (VoxData[1]);
  281.     else
  282.         return (0);
  283. }
  284.  
  285. void SetVoxStop(short value)
  286. {
  287.     short       VoxData[3];
  288.     OSErr       err;
  289.  
  290.     if (value > 0)
  291.         VoxData[0] = 1;                             // turn it on 
  292.     else
  293.         VoxData[0] = 0;                             // turn it on 
  294.     VoxData[1] = value;
  295.     VoxData[2] = GetVoxDelayData();
  296.     err = SPBSetDeviceInfo(gSndInputRef, siVoxStopInfo, (Ptr) VoxData);
  297.     if (err)
  298.         AlertUser(err, eSndInMgr, !kFatalError);
  299. }
  300.  
  301. void SetVoxDelay(short value)
  302. {
  303.     short       VoxData[3];
  304.     OSErr       err;
  305.  
  306.     VoxData[0] = 1;                                 // turn it on 
  307.     VoxData[1] = GetVoxStopData();
  308.     VoxData[2] = value;
  309.     err = SPBSetDeviceInfo(gSndInputRef, siVoxStopInfo, (Ptr) VoxData);
  310.     if (err)
  311.         AlertUser(err, eSndInMgr, !kFatalError);
  312. }
  313.  
  314. short GetVoxDelayData(void)
  315. {
  316.     short       VoxData[3];
  317.     OSErr       err;
  318.  
  319.     err = SPBGetDeviceInfo(gSndInputRef, siVoxStopInfo, (Ptr)VoxData);
  320.     if ( (err == noErr) && (VoxData[0]) )           // noErr and Vox Stop is on 
  321.         return (VoxData[2]);
  322.     else
  323.         return (0);
  324. }
  325.  
  326. short SetLevelMetering(Boolean on)
  327. {
  328.     OSErr           err;
  329.     short           metering;
  330.     
  331.     if (on)
  332.         metering = 1;                             // turn it on 
  333.     else
  334.         metering = 0;                             // turn it off 
  335.     err = SPBSetDeviceInfo(gSndInputRef, siLevelMeterOnOff, (Ptr)&metering);
  336.     if (err)
  337.         AlertUser(err, eSndInMgr, !kFatalError);
  338. }
  339.  
  340. short GetCurLevel(void)
  341. {
  342.     OSErr           err;
  343.     short           meterData[2];
  344.     
  345.     err = SPBGetDeviceInfo(gSndInputRef, siLevelMeterOnOff, (Ptr) meterData);
  346.     if ((err == noErr) && meterData[0])         // no error and level metering on 
  347.         return (meterData[1]);
  348.     else
  349.         return (0);
  350. }
  351.  
  352.  
  353.  
  354. - -----------------------------------------------------------------------
  355. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  356.                              |          Sound Manager Expert
  357. Apple Computer, Inc.         | "All opinions expressed are mine, and do
  358. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  359. Cupertino, CA 95014          |       employer, Apple Computer Inc."
  360.  
  361.  
  362.  
  363. +++++++++++++++++++++++++++
  364.  
  365. From: mcmath@csb1.nlm.nih.gov (Chuck McMath)
  366. Date: 11 Jun 92 19:05:12 GMT
  367. Organization: MSD
  368.  
  369. I have a MacApp/Sound Manager problem that is driving me craaaazy!
  370.  
  371. I *thought* I understood how the Sound Manager worked, but there's one
  372. sticky point with which I am having problems.  My application records
  373. audio using the standard sound input routines, and the audio can be
  374. uncompressed or compressed 3:1 or 6:1.  No problem there.  I save
  375. it to a file.  Now, I want to play back arbitrary portions of it,
  376. based on a user selection.  The standard technique for playing
  377. an audio selection doesn't suffice, since you can only specify
  378. 'play from X seconds in the audio to Y seconds' and I need more
  379. granularity than that.  So here's how I do it:
  380.  
  381.     1. When play is selected, determine start and stop
  382.               bytes of the audio
  383.             
  384.     2. Create a sound channel. For uncompressed it's like this:
  385.             FailOSErr(SndNewChannel(gSCPtr, sampledSynth, initMono, @MarkBuffersFree));
  386.         Otherwise it's like this:
  387.             FailOSErr(SndNewChannel(gSCPtr, sampledSynth, initMono + initMACE3 + initMACE6, ...
  388.         Call SetupSndHeader with the proper parameters for my audio buffers
  389.  
  390.     3. Play audio using a number of buffers:
  391.         3a. Read audio data from file and shove into current audio buffer.
  392.         3b. Schedule a callback.  When it gets called, it simply
  393.                 marks the buffer as 'available' once more.
  394.         3c. Go back to 3a until audio is done.
  395.         
  396.     <Note: step 3 is done using MacApp's Idle mechanism>
  397.     
  398.     4. When audio is done, kill the channel.
  399.     
  400.     Here FINALLY is the problem:  when I play audio that was recorded
  401. at 3:1 or 6:1 compression this technique works great.  However, when I
  402. play audio that was recorded uncompressed, you can (faintly) hear the
  403. original audio, but you hear LOUD scratches/noise.  The question:
  404. what's going on, and how can I fix this problem?
  405.  
  406.  A solution that doesn't involve me changing all 8.5 million lines of
  407. code for this project would be a good one :).
  408.                 
  409.     Any ideas would be appreciated!
  410.     
  411.     Thanks!
  412.     
  413.     chuck
  414.  
  415.                        --chuck mcmath-
  416.                     mcmath@csb1.nlm.nih.gov
  417.   MSD, Inc. * National Library of Medicine * National Institutes of Health
  418.                        Bethesda, MD 20894
  419.  
  420.           "Hey batter, hey batter, hey batter, swing" - Anon.
  421.  
  422. +++++++++++++++++++++++++++
  423.  
  424. From: cfejm@ux1.cts.eiu.edu (John Miller)
  425. Date: Wed, 17 Jun 1992 16:24:06 GMT
  426. Organization: Eastern Illinois University
  427.  
  428. Hi All,
  429.  
  430. The situation:  I've created a shell to explore musical playback using the
  431. Sound Manager.  A simple melody is successfully played back on a Mac II
  432. using System 7 using each of the three synths--sampled, square, and
  433. wave-table, compiled and run separately.
  434.  
  435. The problem:  The same program running on a Plus and an SE under 6.0.5,
  436. 6.0.7, and 6.0.8 is successful playing back the sampled and square-wave
  437. example, but has strange results when using the wave-table synth--the
  438. example does not start at the beginning, and occasional other
  439. irregularities (wrong octave) result.
  440.  
  441. Any advice?
  442.  
  443. Thanks in advance
  444.  
  445.  
  446. John
  447.  
  448.  
  449. - -- 
  450. John Miller
  451. Music Theory
  452. Eastern Illinois University
  453.  
  454. +++++++++++++++++++++++++++
  455.  
  456. From: potts@itl.itd.umich.edu (Paul Potts)
  457. Organization: Instructional Technology Laboratory, University of Michigan
  458. Date: Wed, 17 Jun 92 21:59:19 GMT
  459.  
  460. In article <1992Jun17.162406.29904@ux1.cts.eiu.edu> cfejm@ux1.cts.eiu.edu (John Miller) writes:
  461. >Hi All,
  462. >
  463. >The situation:  I've created a shell to explore musical playback using the
  464. >Sound Manager.  A simple melody is successfully played back on a Mac II
  465. >using System 7 using each of the three synths--sampled, square, and
  466. >wave-table, compiled and run separately.
  467. >
  468. >The problem:  The same program running on a Plus and an SE under 6.0.5,
  469. >6.0.7, and 6.0.8 is successful playing back the sampled and square-wave
  470. >example, but has strange results when using the wave-table synth--the
  471. >example does not start at the beginning, and occasional other
  472. >irregularities (wrong octave) result.
  473.  
  474. First off, I wouldn't attempt to do much with the sound manager under 6.0.5.
  475. Stick with 6.0.7 or above, which has a later version.
  476.  
  477. The wave-table synth is a little weird, but I've had some luck with it. 
  478. You aren't trying to pass it real frequency values, are you? Use only MIDI
  479. note values. Passing real frequency values will cause strange results.
  480. The documentation was wrong about this for some time, but I-M 7 has it
  481. right.
  482.  
  483. Other than that, maybe post some code?
  484.  
  485.  
  486. - -- 
  487. The essence of OOP: "With all this horse manure, I know there's got to be
  488.                      a pony in here somewhere!"
  489. Paul R. Potts, Software Designer --- potts@itl.itd.umich.edu <--- me!
  490.  
  491. +++++++++++++++++++++++++++
  492.  
  493. From: REEKES@applelink.apple.com (Jim Reekes)
  494. Date: 25 Jun 92 01:05:03 GMT
  495. Organization: Apple Computer, Inc.
  496.  
  497. In article <1992Jun17.162406.29904@ux1.cts.eiu.edu>, cfejm@ux1.cts.eiu.edu (John Miller) writes:
  498. > Hi All,
  499. > The situation:  I've created a shell to explore musical playback using the
  500. > Sound Manager.  A simple melody is successfully played back on a Mac II
  501. > using System 7 using each of the three synths--sampled, square, and
  502. > wave-table, compiled and run separately.
  503. > The problem:  The same program running on a Plus and an SE under 6.0.5,
  504. > 6.0.7, and 6.0.8 is successful playing back the sampled and square-wave
  505. > example, but has strange results when using the wave-table synth--the
  506. > example does not start at the beginning, and occasional other
  507. > irregularities (wrong octave) result.
  508. > Any advice?
  509.  
  510. The wave table channels do not work on "classic" hardware not running the
  511. new Sound Manager.  These are the Plus, SE, or Classic under a system
  512. older than 6.0.7.  Also, you should try your code under System 7.0.
  513. I'm certain that 7.0 sound manager is going to work for you.
  514.  
  515. "Make is suck less" is the motto.
  516.  
  517. - -----------------------------------------------------------------------
  518. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  519.                              |          Sound Manager Expert
  520. Apple Computer, Inc.         | RAll opinions expressed are mine, and do
  521. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  522. Cupertino, CA 95014          |       employer, Apple Computer Inc.S
  523.  
  524.  
  525.  
  526. +++++++++++++++++++++++++++
  527.  
  528. From: davisw@aurs01.uucp (Walt Davis)
  529. Date: 8 Jul 92 22:42:11 GMT
  530. Organization: Alcatel Network Systems, Raleigh NC
  531.  
  532. I'm new in sound-programming game and I'm having problems getting some
  533. of my simple, asynchronous (or synchronous for that matter) sound
  534. manager code to behave properly on 68000-based SEs and Pluses.  All I'm
  535. trying to do is play little 'snd ' resources (type 1) on sampledSynth
  536. sound channels.  Everything works fine on IIs and up.  Obviously I'm
  537. missing something obvious.  I suspect some type of sound-manager
  538. incompatibilities (couldn't be me ;-)).  SOS...
  539.  
  540. Walt Davis
  541. davisw%aurfs1%aurgate@mcnc.org
  542. AOL: DavisW
  543.  
  544. +++++++++++++++++++++++++++
  545.  
  546. From: mlanett@Apple.COM (Mark Lanett)
  547. Date: 9 Jul 92 07:20:58 GMT
  548. Organization: Apple Computer Inc., Cupertino, CA
  549.  
  550. davisw@aurs01.uucp (Walt Davis) writes:
  551.  
  552. >I'm new in sound-programming game and I'm having problems getting some
  553. >of my simple, asynchronous (or synchronous for that matter) sound
  554. >manager code to behave properly on 68000-based SEs and Pluses.  All I'm
  555. >trying to do is play little 'snd ' resources (type 1) on sampledSynth
  556. >sound channels.  Everything works fine on IIs and up.  Obviously I'm
  557. >missing something obvious.  I suspect some type of sound-manager
  558. >incompatibilities (couldn't be me ;-)).  SOS...
  559.  
  560. Try hardware incompatibilities. Pluses and SEs don't have the sound chip
  561. required for some things like play from disk and playing multiple sound
  562. channels. Having only spent 3 days or so tinkering with the Sound Manager I'm
  563. not clear on what exactly won't work, however.
  564. - -- 
  565. Have a bajillion brilliant Jobsian lithium licks.
  566. Mark Lanett
  567.  
  568. +++++++++++++++++++++++++++
  569.  
  570. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  571. Organization: Kalamazoo College
  572. Date: Thu, 9 Jul 1992 13:07:52 GMT
  573.  
  574. mlanett@Apple.COM (Mark Lanett) writes:
  575. >davisw@aurs01.uucp (Walt Davis) writes:
  576. >
  577. >>I'm new in sound-programming game and I'm having problems getting some
  578. >>of my simple, asynchronous (or synchronous for that matter) sound
  579. >>manager code
  580.  
  581. "Simple, asynchronous sound manager code" is oxymoronic...
  582.  
  583. >>to behave properly on 68000-based SEs and Pluses.  All I'm
  584. >>trying to do is play little 'snd ' resources (type 1) on sampledSynth
  585. >>sound channels.  Everything works fine on IIs and up.  Obviously I'm
  586. >>missing something obvious.  I suspect some type of sound-manager
  587. >>incompatibilities (couldn't be me ;-)).
  588. >
  589. >Try hardware incompatibilities. Pluses and SEs don't have the sound chip
  590. >required for some things like play from disk and playing multiple sound
  591. >channels.
  592.  
  593. There are many and various things which can go wrong when you try to
  594. play sound.  I don't think we can blame anything in particular at this
  595. point.
  596.  
  597. Mark, make sure you're using the same system on all machines;  6.0.7 or
  598. 7 would be best.  Don't use Macintalk or SoundMaster, and don't run any
  599. applications that use the Sound Driver.  And post the code you're using;
  600. pseudo-code is OK if it's accurate.
  601. - -- 
  602.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  603.  I suppose ya don't think I was run over by a streetcar!
  604.  
  605. +++++++++++++++++++++++++++
  606.  
  607. From: ccmlh@buitc.bu.edu (Mark Hayes)
  608. Date: 9 Jul 92 16:34:10 GMT
  609. Organization: Boston University, Boston, MA, USA
  610.  
  611. Since there's been some more discussion recently about sound problems,
  612. I'd like to re-present a problem I mentioned a while ago, with some new
  613. information, and again ask if anyone knows why things go as they do.
  614.  
  615. This little test program runs just dandy on my SE/30 under System 7.0;
  616. it plays an (uncompressed) 'snd' resource ten times and exits.
  617. If, however, I run it on an SE/30 under System 6.0.7, or on an SE under 7.0,
  618. the sound plays once and only once. Here's the code:
  619.  
  620.     void main(void)
  621.     {
  622.     OSErr myErr; SndChannelPtr myChanPtr; Handle myHandle; short x;
  623.  
  624.     myChanPtr = nil;
  625.     myErr = SndNewChannel(&myChanPtr, 0, 0L, nil);
  626.     myHandle = GetNamedResource('snd ', "\pmySound");
  627.  
  628.     for (x = 0; x < 10; x++)
  629.         myErr = SndPlay(myChanPtr, myHandle, false);
  630.  
  631.     myErr = SndDisposeChannel(myChanPtr, true);
  632.     }
  633.  
  634. Now, if I change the program so that it doesn't allocate and retain a
  635. channel across multiple SndPlay calls, it works on all three systems:
  636.  
  637.     for (x = 0; x < 10; x++)
  638.         myErr = SndPlay(nil, myHandle, false);
  639.  
  640. I know Apple recommends that one *not* retain a channel in the way I want to,
  641. but there definitely is a performance hit in the second program that I'd prefer
  642. to avoid. In the real programs I'm working on, I do de- and re-allocate the
  643. channel in the event of a suspend/resume, or if my own code puts up a dialog.
  644. And the sound plays are synchronous, so it's not (?) a timing problem.
  645. So why does this first sample program work on the System 7 SE/30 but not
  646. on the other two systems?
  647.  
  648. Also, while I'm here, what, please, are the system and machine requirements
  649. for the use of compressed sounds with SndPlay? I believe I'm talking about
  650. a capability called "MACE", but I don't know what systems support it and what
  651. systems don't.
  652.  
  653. Thanks to anyone for any help.
  654.                                                               Mark
  655.  
  656. +++++++++++++++++++++++++++
  657.  
  658. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  659. Organization: Kalamazoo College
  660. Date: Thu, 9 Jul 1992 18:07:32 GMT
  661.  
  662. ccmlh@buitc.bu.edu (Mark Hayes) writes:
  663. >
  664. >This little test program runs just dandy on my SE/30 under System 7.0;
  665. >it plays an (uncompressed) 'snd' resource ten times and exits.
  666. >If, however, I run it on an SE/30 under System 6.0.7, or on an SE under 7.0,
  667. >the sound plays once and only once. Here's the code:
  668. >
  669. >    ...
  670. >    myChanPtr = nil;
  671. >    myErr = SndNewChannel(&myChanPtr, 0, 0L, nil);
  672. >    for (x = 0; x < 10; x++)
  673. >        myErr = SndPlay(myChanPtr, myHandle, false);
  674. >    myErr = SndDisposeChannel(myChanPtr, true);
  675. >    ...
  676. >
  677. >Now, if I change the program so that it doesn't allocate and retain a
  678. >channel across multiple SndPlay calls, it works on all three systems:
  679. >
  680. >    for (x = 0; x < 10; x++)
  681. >        myErr = SndPlay(nil, myHandle, false);
  682. >
  683. >I know Apple recommends that one *not* retain a channel in the way I want to,
  684.  
  685. They do?  I couldn't find that in IM VI...
  686.  
  687. But if so, then listen to Apple and don't do it!
  688.  
  689. >but there definitely is a performance hit in the second program that I'd prefer
  690. >to avoid.
  691.  
  692. Don't use SndPlay, then.  Instead, do this with the channel:
  693.  
  694. SndCommand s;
  695. s.cmd = flushCmd;
  696. FailOSErr(SndDoImmediate(myChanPtr, &s));
  697. s.cmd = quietCmd;
  698. FailOSErr(SndDoImmediate(myChanPtr, &s));
  699. HLock(myHandle);
  700. s.cmd = bufferCmd;
  701. s.param2 = StripAddress(*myHandle) + offsetToStartOfSndBuffer(myHandle);
  702. FailOSErr(SndDoCommand(myChanPtr, &s, TRUE));
  703. // keep the handle locked until the sound completes
  704.  
  705. You'll have to write the function offsetToStartOfSndBuffer() yourself.
  706. It's a ten-line no-brainer that takes a handle and returns the offset to
  707. the start of the sound buffer, which is _not_ the raw data, it's what
  708. immediately follows the sound commands in the 'snd ' resources.
  709.  
  710. >Also, while I'm here, what, please, are the system and machine requirements
  711. >for the use of compressed sounds with SndPlay? I believe I'm talking about
  712. >a capability called "MACE", but I don't know what systems support it and what
  713. >systems don't.
  714.  
  715. You need the system 6.0.7 or later Sound Manager to use MACE.  It stands
  716. to reason that MACEVersion() would return nonzero if MACE is present,
  717. but don't hold me to that.  My system 7.0.1 returns "1.0.1 final".
  718. - -- 
  719.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  720.  When the ship runs out of water and the vessel runs aground, land's where we
  721.  know the boat is found.  Now, there's nothing unexpected about the water
  722.  giving out;  "land"'s not a word we have to shout.  -- TMBG, "Women and Men"
  723.  
  724. +++++++++++++++++++++++++++
  725.  
  726. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  727. Date: 10 Jul 92 13:54:43 GMT
  728. Organization: Kalamazoo College
  729.  
  730. k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  731. >ccmlh@buitc.bu.edu (Mark Hayes) writes:
  732. >>
  733. >>I know Apple recommends that one *not* retain a channel in the way I want to
  734. >
  735. >They do?  I couldn't find that in IM VI...
  736.  
  737. Then, davisw%aurfs1%aurgate@mcnc.org (Walt Davis) advises me via email:
  738. >
  739. >See IM VI page 22-40...
  740.  
  741. Aha.  The actual warning is "...sound channels are for temporary use,
  742. and...you should create them just before playing sounds.  Once the sound
  743. is completed, you should dispose of the channel."
  744.  
  745. Don't take this warning _too_ seriously.  Most programs should follow
  746. it, because it's good advice:  if you keep a sampledSynth sound channel
  747. open continuously, the user will never hear a "Simple Beep" SysBeep,
  748. because it uses a different synthesizer.  That's just one reason why you
  749. should close sound channels when you don't need them.
  750.  
  751. But when you do need them, don't be stingy.  If you need to play ten
  752. noisess in a row, there's absolutely no reason why you shouldn't keep one
  753. channel open for all ten noises.  If your arcade game has lots of sound,
  754. keep as many channels open as you need.  Now, when the player switches you
  755. into the background, or otherwise pauses the action, then you should
  756. dispose of them.  But there's no reason to get in a frenzy of religiously
  757. allocating and disposing SndChannels every time you play a sound.
  758. - -- 
  759.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  760.  When the ship runs out of water and the vessel runs aground, land's where we
  761.  know the boat is found.  Now, there's nothing unexpected about the water
  762.  giving out;  "land"'s not a word we have to shout.  -- TMBG, "Women and Men"
  763.  
  764. +++++++++++++++++++++++++++
  765.  
  766. From: potts@itl.itd.umich.edu (Paul Potts)
  767. Date: 10 Jul 92 20:04:15 GMT
  768. Organization: Instructional Technology Laboratory, University of Michigan
  769.  
  770. In article <69799@apple.Apple.COM> mlanett@Apple.COM (Mark Lanett) writes:
  771. >davisw@aurs01.uucp (Walt Davis) writes:
  772. >
  773. >>I'm new in sound-programming game and I'm having problems getting some
  774. >>of my simple, asynchronous (or synchronous for that matter) sound
  775. >>manager code to behave properly on 68000-based SEs and Pluses.  All I'm
  776. >>trying to do is play little 'snd ' resources (type 1) on sampledSynth
  777. >>sound channels.  
  778.  
  779. There aren't any compatibility problems that would make it impossible to
  780. play a type 1 sound on a 68000-based machine. It does work - or else how would
  781. you be able to use a cow mooing or whatever for your system beep?
  782.  
  783. Show us some code... maybe we can get a better idea that way. Keep in mind that
  784. it is possible a bug elsewhere could cause a crash when you call the
  785. sound manager. Are you checking all the error returns properly? There are
  786. things that you can't do with sound on the low-end macs, but the sound manager
  787. will usually tell you.
  788.  
  789. - -- 
  790. ..though I respect that a lot, I'd be fired if that were my job, after 
  791. killing Jason off and countless screaming argonauts... (They Might Be Giants)
  792. Paul R. Potts, Software Designer --- potts@itl.itd.umich.edu <--- me!
  793.  
  794. +++++++++++++++++++++++++++
  795.  
  796. From: Daniel E. Rudman <rudman@caen.engin.umich.edu>
  797. Date: Fri, 17 Jul 92 03:34:07 EDT
  798. Organization: The University of Michigan Ann Arbor
  799.  
  800. In article <90645@bu.edu> Mark Hayes, ccmlh@buitc.bu.edu writes:
  801.  
  802. >    void main(void)
  803. >    OSErr myErr; SndChannelPtr myChanPtr; Handle myHandle; short x;
  804. >    myChanPtr = nil;
  805. >    myErr = SndNewChannel(&myChanPtr, 0, 0L, nil);
  806. >    myHandle = GetNamedResource('snd ', "\pmySound");
  807. >    for (x = 0; x < 10; x++)
  808. >        myErr = SndPlay(myChanPtr, myHandle, false);
  809. >    myErr = SndDisposeChannel(myChanPtr, true);
  810. >    }
  811.  
  812. I don't know if this helps, but I don't think it's a really good idea to call
  813. SndNewChannel with 0 as your synth and your modifier; I think you should
  814. probably use sampleSynth and monoWhateverTheHellItIs or whatever. Zero is not
  815. defined in Inside Mac VI, and I wouldn't suggest using it. I've had problems
  816. with the Sound Manager when trying that.
  817.  
  818. Also, if you ever plan on coming BACK to that section of the code (not in
  819. this case, obviously, but you never know) then make sure you FORCE THE
  820. CHANNEL POINTER TO NIL. SndNewChannel doesn't work so well when you pass it
  821. the remains of your disposed channel. Anyway, that doesn't happen here but I
  822. thought I'd mention it.
  823.  
  824. - ------------------------------------------------------------
  825. Daniel E. Rudman
  826. The University of Michigan
  827. Computer-Aided Engineering Network
  828.  
  829. +++++++++++++++++++++++++++
  830.  
  831. From: danny@utkux1.utk.edu (Danny W. McCampbell)
  832. Date: 10 Aug 92 19:57:22 GMT
  833. Organization: University of Tennessee
  834.  
  835. I want to thank those who responded to my question about playing simple
  836. sounds from within my program.  Now I have more questions.  If I 
  837. understand IM Vol. VI correctly I can call SndStartFilePlay I can
  838. control the sound the way I want to.  Right now I am just using
  839. SndPlay to play the sound and everything works fine except that I 
  840. cannot proceed to do anything else until the sound (which is extremely
  841. large) finishes playing.  I want to be able to let the sound play
  842. while I continue to do things within program.  I tried using
  843. SndStartFilePlay but the error that it returns is -201 which is
  844. Insufficient hardware available.  I have a MacII CI with 8 megs of
  845. ram and plenty of hard disk space.  Is there something specific
  846. that I have to have like a microphone jack to call SndStartFilePlay?
  847. If anyone out there has some code laying around that would help me
  848. better understand what I am doing, I would greatly appreciate getting
  849. a look at it.  I am just merely calling a modal dialog, starting a 
  850. sound and waiting for the user to click OK.  When they click OK I want
  851. to stop the sound and close the dialog. 
  852.  
  853. Thanks in advance.
  854.  
  855. Sorry for being so ignorant.
  856.  
  857. Danny McCampbell
  858. danny@utkux1.utk.edu
  859.  
  860. +++++++++++++++++++++++++++
  861.  
  862. From: neath@brazil.psych.purdue.edu (Ian Neath)
  863. Date: 10 Aug 92 20:21:39 GMT
  864. Organization: Psychology Department, Purdue University
  865.  
  866. I recall a while back a mention about the Sound Manager chapter
  867. in IM 6 that implied it had been superseded.  Is this correct?
  868. If so, where can I find how to play SND s asynchronously under
  869. System 7?  I've found that my System 6 async code plays
  870. synchronously under 7.  If it is accurate, I'd appreciate knowing
  871. that also.
  872.  
  873. Thanks.
  874.  
  875. - --
  876.     Ian Neath, PhD     | There are four kinds of people in this world:
  877. neath@psych.purdue.edu | cretins, fools, morons and lunatics - U. Eco
  878.  
  879. +++++++++++++++++++++++++++
  880.  
  881. From: chuck@gte.com (Chuck Hoffman)
  882. Date: 1 Sep 92 19:55:02 GMT
  883. Organization: GTE Laboratories
  884.  
  885. I'm just getting into the Sound Manager and am using the simple note
  886. synthesizer.  I created a sound resource with ResEdit (created my own 'snd
  887. ' template) and the sound plays fine from ResEdit and my program.  Playing
  888. asynchronously.  When the sound is done, I have a CallBackCmd to invoke my
  889. callback routine which simply sets a flag so that I can later dispose of
  890. the channel and release the sound resource.  I've done this by putting the
  891. callback command at the end of the sound resource, and by using
  892. SndDoCommand to insert into the buffer.  In both cases, it works correctly
  893. about 2 of 3 times.  Can't set a THINK C debugger breakpoint in the
  894. callback routine because of crashes (a conflict with the memory manager?),
  895. but the main event loop sees the variable as if it has not been set.  I've
  896. tried code updating the flag (in a global variable) directly, and I've
  897. tried passing the address of the variable to the subroutine and getting at
  898. it that way.  Same symptom no matter what.  Any ideas?
  899.  
  900.  
  901. Chuck Hoffman
  902. chuck@gte.com
  903. GTE Laboratories, Waltham, Massachusetts, USA
  904. (617) 466-2131
  905. =====================================
  906. I'm not sure why we're here, but I am sure that while we're here we're
  907. supposed to help each other.
  908. =====================================
  909.  
  910. +++++++++++++++++++++++++++
  911.  
  912. From: johnsd2@jec324.its.rpi.edu (Daniel Norman Johnson)
  913. Organization: Rensselaer Polytechnic Institute, Troy, NY.
  914. Date: Thu, 1 Oct 1992 18:35:27 GMT
  915.  
  916. I am having a problem with an extension I am writing. This extension
  917. is really a background app (type='appe'), which plays sounds asynchronously
  918. in the background (which sounds are specified with annother program, that
  919. works);
  920.  
  921. Most of the time it works fine but I am having 2 odd problems that I haven't
  922. been able to track down.
  923.  
  924. One sound that I have, namely "Spanish Inquisition" ("<BLAM> NOOOOOOOBody
  925. expects the Spanish Inquisition!") Is giving me trouble. This sound
  926. plays synchronously just fine. Asynchronously, it SOMETIMES plays
  927. fine. When the appe is running as an APPL (so I can double
  928. click it+ don't have to restart to fool with it), it plays fine.
  929. When my app is running as an appe (ie normally) the sound plays
  930. but the extension then freezes up. Everything else continues
  931. working fine, but the extension will not play anything or respond
  932. to apple events (notably 'QUIT'- something of a pain when u r trying
  933. to Shut Down); This strange freeze happens on a friends LC whenever
  934. the sound is played, even  from an APPL. (but only if its
  935. asynchronously)
  936.  
  937. The other problem seems to be an incompatibility with AutoDoubler,
  938. versions 1.0.6 and 1.0.7 at least. On my friend's LC it cannot
  939. play Autodoubler compressed sounds. The whole system freezes if its
  940. tries to do so, but only if I am not trying to use the Think Pascal
  941. debugger on it. :( So I dont know exactly what's happeneing; maybe
  942. the sound is freezing when it loads or something. Is there a known
  943. bug in AutoDoubler that could do this? This bug does not occur
  944. on my system, at all.
  945.  
  946. I am writing this in Think Pascal 4.0, on a Macintosh IIcx 5/100. I
  947. am using AutoDoubler 1.0.7 (my friend was using 1.0.6, but I got him
  948. the update thinking that would solve the problem. It didn't.) My
  949. friends LC was a 4/40 btw.
  950.  
  951. Thanx in advance!
  952.  
  953. - -- 
  954.             - Dan Johnson
  955. And God said "Jeeze, this is dull"... and it *WAS* dull. Genesis 0:0
  956.  
  957. These opinions have had all identifiying marks removed, and are untraceable.
  958. You'll never know whose they are.
  959.  
  960. +++++++++++++++++++++++++++
  961.  
  962. From: Matthew_J._Meyer@bmug.org
  963. Organization: BMUG, Inc.
  964. Date: Fri, 02 Oct 1992 20:41:03 PDT
  965.  
  966. I ran into similar sound problems (in an 'appl' only) where I needed to
  967. play an async sound repeatedly (machine gun type effect). All sound on
  968. my LC would stop after a few cycles of the sound. I found that by adding
  969. a slight delay (3 - 6 ticks) before trying to replay the sound
  970. everything was fine. Perhaps this will help your situation...?
  971. ***************************************************************************
  972.              From Planet BMUG, the FirstClass BBS of BMUG, Inc.
  973.               The above message was gatewayed via PostalUnion
  974. ***************************************************************************
  975. The message contained in this posting is entirely the poster's personal
  976. opinion.  Any possible, real or perceived, (dis)similarities with the
  977. views held by BMUG, are purely coincidental.
  978. ***************************************************************************
  979.  
  980. +++++++++++++++++++++++++++
  981.  
  982. From: dan@chaos.cs.brandeis.edu (Dan Schwarz)
  983. Date: 5 Oct 92 02:27:12 GMT
  984. Organization: Brandeis University
  985.  
  986. In article <w=mz_wc@rpi.edu> johnsd2@rpi.edu writes:
  987. >I am having a problem with an extension I am writing. This extension
  988. >is really a background app (type='appe'), which plays sounds asynchronously
  989. >in the background (which sounds are specified with annother program, that
  990. >works);
  991. ...
  992. >This strange freeze happens on a friends LC whenever
  993. >the sound is played, even  from an APPL. (but only if its
  994. >asynchronously)
  995.  
  996. Speaking as a programmer who has done some SERIOUS sound manager hacking,
  997. I can sympathize with your frustration. Here's what I can tell you:
  998.  
  999. * the Mac LC uses a crippled version of the Apple Sound Chip. So does the LC II
  1000. and Classic II, by the way. Major difference is that this chip can only handle
  1001. monophonic sound output, and cannot support simultaneous sound recording &
  1002. playback.
  1003.  
  1004. * the System 6.0.7 and 6.0.6 sound managers have MAJOR bugs, especially when
  1005. dealing with the LC. These systems' sound input managers were taken directly
  1006. from alpha versions of System 7.0 (in the rush to ship the first LC and IIsi 
  1007. units.) Don't trust the Gestalt values they return, for example.
  1008.  
  1009. * Use 7.0 or later versions, but this won't solve all your problems. I am 
  1010. convinced that there are hardware or software bugs in Apple's handling of
  1011. this particular sound chip. For example, play back a QuickTime movie with
  1012. sound (in SimplePlayer or any similar product.) Switch out of the layer
  1013. into a product which does sound recording or otherwise uses the sound manager.
  1014. Switch back. Odds are, the sound will be silenced upon returning to the QT
  1015. movie. I don't know how to solve this problem.
  1016.  
  1017. Unless the "delay" tactic mentioned earlier is successful, the only thing
  1018. you can do is to complain to MacDTS until you get a reasonable response.
  1019. They're not very forthcoming about Mac sound internals, but be specific with
  1020. your problem and maybe you can get a workaround.
  1021.  
  1022. _Dan
  1023.  
  1024. +++++++++++++++++++++++++++
  1025.  
  1026. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  1027. Organization: Kalamazoo College
  1028. Date: Mon, 5 Oct 1992 13:09:14 GMT
  1029.  
  1030. dan@chaos.cs.brandeis.edu (Dan Schwarz) writes:
  1031. >
  1032. >* the Mac LC uses a crippled version of the Apple Sound Chip. So does the LC II
  1033. >and Classic II, by the way. Major difference is that this chip can only handle
  1034. >monophonic sound output, and cannot support simultaneous sound recording &
  1035. >playback.
  1036.  
  1037. Hmmm.  Well, the preliminary developer note for the LC (I seem to have
  1038. lost the final :-) says it "implements a subset of the ASC," but I think
  1039. it would more accurately be described as really simple hardware and a
  1040. Sound Manager that tries to make up for it.
  1041.  
  1042. Another difference is that the LC doesn't support the 4-channel
  1043. wavetable mode, which is part of the ASC.  (But does the Sound Manager
  1044. recognize an ASC and use it for 4-channel wavetables?  Theoretically,
  1045. four waveTableSynth channels should take almost no CPU time.  Has anyone
  1046. checked this out?)
  1047.  
  1048. Later, it says "The sound system is similar to the Plus and SE sound
  1049. systems in that main memory is used for the sound buffer.  Because the
  1050. Macintosh LC computer's video modes have different line times...the
  1051. sound system has its own timing chain, which samples at the same
  1052. rate..."  Later it explains that this stuff is built into the V8 gate
  1053. array, which appears to be a catch-all custom chip to do a hodgepodge of
  1054. things that lots of little chips used to take care of.  (You can see by
  1055. my language that I'm not a hardware person.  :-)
  1056.  
  1057. Anyway, it looks like "subset of the ASC" is misleading.  I'd call it a
  1058. "simulation of the chintzy RAM-sampling technique used by the original
  1059. 128K Mac, plus sound input, all tied together by the much-overworked
  1060. Sound Manager."
  1061.  
  1062. Can anyone who knows more about the LC, and hardware in general, expound
  1063. on this?
  1064.  
  1065. >* the System 6.0.7 and 6.0.6 sound managers have MAJOR bugs, especially when
  1066. >dealing with the LC.
  1067.  
  1068. Well, I don't know about the LC in particular, but those sound managers
  1069. in general are a _lot_ more trustworthy than in previous versions.
  1070.  
  1071. >Unless the "delay" tactic mentioned earlier is successful, the only thing
  1072. >you can do is to complain to MacDTS until you get a reasonable response.
  1073.  
  1074. I was going to suggest using a custom double-buffering routine, but I've
  1075. never done it myself so I can't give advice.  I'd try that before
  1076. calling up MacDTS though.
  1077. - -- 
  1078.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  1079.  "I don't think we should have to have them wandering the streets
  1080.   frightening women and people."                            - Pat Buchanan
  1081.  
  1082. +++++++++++++++++++++++++++
  1083.  
  1084. From: johnsd2@vccsouth07.its.rpi.edu (Daniel Norman Johnson)
  1085. Date: 5 Oct 92 15:34:34 GMT
  1086. Organization: Rensselaer Polytechnic Institute, Troy, NY.
  1087.  
  1088. In article <1992Oct5.022712.3448@news.cs.brandeis.edu>, dan@chaos.cs.brandeis.edu (Dan Schwarz) writes:
  1089. |> In article <w=mz_wc@rpi.edu> johnsd2@rpi.edu writes:
  1090. |> >I am having a problem with an extension I am writing. This extension
  1091. |> >is really a background app (type='appe'), which plays sounds asynchronously
  1092. |> >in the background (which sounds are specified with annother program, that
  1093. |> >works);
  1094. |> ...
  1095. |> >This strange freeze happens on a friends LC whenever
  1096. |> >the sound is played, even  from an APPL. (but only if its
  1097. |> >asynchronously)
  1098. |> 
  1099. |> Speaking as a programmer who has done some SERIOUS sound manager hacking,
  1100. |> I can sympathize with your frustration. Here's what I can tell you:
  1101. |> 
  1102. |> * the Mac LC uses a crippled version of the Apple Sound Chip. So does the LC II
  1103. |> and Classic II, by the way. Major difference is that this chip can only handle
  1104. |> monophonic sound output, and cannot support simultaneous sound recording &
  1105. |> playback.
  1106.  
  1107. Im just using SndPlay(blah,blah,True); to do this; It should be monophonic
  1108. and (for these sounds) just ordinary sampled sound. I think.
  1109.  
  1110. |> * the System 6.0.7 and 6.0.6 sound managers have MAJOR bugs, especially when
  1111. |> dealing with the LC. These systems' sound input managers were taken directly
  1112. |> from alpha versions of System 7.0 (in the rush to ship the first LC and IIsi 
  1113. |> units.) Don't trust the Gestalt values they return, for example.
  1114.  
  1115. I don't. I dont even call Gestalt, and I dont use sound Input. Could you
  1116. be a little more specific about the bugs, that is any bugs that might
  1117. louse up asynchronous sound playback?
  1118.  
  1119. |> * Use 7.0 or later versions, but this won't solve all your problems. I am 
  1120. |> convinced that there are hardware or software bugs in Apple's handling of
  1121. |> this particular sound chip. For example, play back a QuickTime movie with
  1122. |> sound (in SimplePlayer or any similar product.) Switch out of the layer
  1123. |> into a product which does sound recording or otherwise uses the sound manager.
  1124. |> Switch back. Odds are, the sound will be silenced upon returning to the QT
  1125. |> movie. I don't know how to solve this problem.
  1126.  
  1127. Bleah. No, make that Double-bleah.
  1128.  
  1129. |> Unless the "delay" tactic mentioned earlier is successful, the only thing
  1130. |> you can do is to complain to MacDTS until you get a reasonable response.
  1131. |> They're not very forthcoming about Mac sound internals, but be specific with
  1132. |> your problem and maybe you can get a workaround.
  1133.  
  1134. Ill try to boost the delay, but it already has some delay in it- specificly
  1135. it calls WaitNextEvent so it cant start the next sound until that comes
  1136. back (which should be good for a few ticks, anyway.) So I dont know about
  1137. that. (I cant do it right now, cuz my roommates asleep. :( )
  1138.  
  1139. In any case, the latest version of it always closes the sound channel and opens
  1140. it again before each sound. This has teh spiffy effect that it can now
  1141. plays sounds after the Spanish Inquisition (but that does not play). So its
  1142. getting better. No progress on teh autodoubler problem tho.
  1143.  
  1144. - -- 
  1145.             - Dan Johnson
  1146. And God said "Jeeze, this is dull"... and it *WAS* dull. Genesis 0:0
  1147.  
  1148. These opinions have had all identifiying marks removed, and are untraceable.
  1149. You'll never know whose they are.
  1150.  
  1151. +++++++++++++++++++++++++++
  1152.  
  1153. From: johnsd2@vccsouth07.its.rpi.edu (Daniel Norman Johnson)
  1154. Organization: Rensselaer Polytechnic Institute, Troy, NY.
  1155. Date: Mon, 5 Oct 1992 15:37:50 GMT
  1156.  
  1157. In article <1992Oct5.130914.28967@hobbes.kzoo.edu>, k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  1158. |> dan@chaos.cs.brandeis.edu (Dan Schwarz) writes:
  1159. |> >
  1160. [deletia- details on LC ASC]
  1161. |> 
  1162. |> >Unless the "delay" tactic mentioned earlier is successful, the only thing
  1163. |> >you can do is to complain to MacDTS until you get a reasonable response.
  1164. |> 
  1165. |> I was going to suggest using a custom double-buffering routine, but I've
  1166. |> never done it myself so I can't give advice.  I'd try that before
  1167. |> calling up MacDTS though.
  1168.  
  1169. Waitaminute. I thot double buffering was a trick you could do
  1170. to play direct from disk... if not, what is it?
  1171.  
  1172. - -- 
  1173.             - Dan Johnson
  1174. And God said "Jeeze, this is dull"... and it *WAS* dull. Genesis 0:0
  1175.  
  1176. These opinions have had all identifiying marks removed, and are untraceable.
  1177. You'll never know whose they are.
  1178.  
  1179. +++++++++++++++++++++++++++
  1180.  
  1181. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  1182. Date: 6 Oct 92 10:32:39 GMT
  1183. Organization: Kalamazoo College
  1184.  
  1185. ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  1186. >(Jamie R. McCarthy) writes:
  1187. >>
  1188. >> Well, I don't know about the LC in particular, but [the 6.0.6&7 SMs]
  1189. >> in general are a _lot_ more trustworthy than in previous versions.
  1190. >
  1191. >I know of one major snag with the 6.0.7 Sound Manager. ...  I had a brief
  1192. >chance to check it myself, and discovered that it was dying in the resume loop.
  1193. >
  1194. >Idea: perhaps it has something to do with spurious invocation of my callback
  1195. >routine. I recall Jim Reekes mentioning that this was possible, though I
  1196. >don't recall what the precise conditions were.
  1197.  
  1198. Someone else mentioned once that your callback can get called
  1199. inappropriately under 6.0.4 (or was it .5?), so I always check in my
  1200. routines.  (My technique, for what it's worth, is to put an identifying
  1201. constant in param1 and my app's A5 in param2.)
  1202.  
  1203. If you can get that 4-voice-harmony XCMD to work under 6.0.7, Lawrence,
  1204. a lot of people in the music-education biz would be very grateful.  :-)
  1205. - -- 
  1206.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  1207.  Memo to myself:
  1208.  Do The Dumb Things I Gotta Do.
  1209.  Touch The Puppet Head.
  1210.  
  1211. +++++++++++++++++++++++++++
  1212.  
  1213. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  1214. Organization: Kalamazoo College
  1215. Date: Tue, 6 Oct 1992 12:49:41 GMT
  1216.  
  1217. johnsd2@rpi.edu writes:
  1218. >Jamie R. McCarthy writes:
  1219. >> I was going to suggest using a custom double-buffering routine, but I've
  1220. >> never done it myself so I can't give advice.  I'd try that before
  1221. >> calling up MacDTS though.
  1222. >
  1223. >Waitaminute. I thot double buffering was a trick you could do
  1224. >to play direct from disk... if not, what is it?
  1225.  
  1226. To quote IM VI 22-72:  "The play-from-disk routines make extensive use
  1227. of the SndPlayDoubleBuffer function.  ...  By using SndPlayDoubleBuffer
  1228. ...you can specify your own doubleback procedure (that is, the algorithm
  1229. used to switch back and forth between buffers) and customize several
  1230. other buffering parameters.  Note:  SndPlayDoubleBuffer is a very
  1231. low-level routine and is not intended for general use.  You should use
  1232. SndPlayDoubleBuffer only if you require very fine control over double
  1233. buffering."
  1234.  
  1235. Double buffering will allow you to play sounds back-to-back,
  1236. continuously.  You can get the sounds directly from disk if that's what
  1237. your doubleback procedure does;  or, you can synthesize them, read them
  1238. from RAM, whatever.
  1239.  
  1240. The initial question (I think?!) was about playing some sounds
  1241. back-to-back.  Double-buffering will let you do that too (though, if you
  1242. have the RAM, and you don't mind BlockMove()ing it around, it's easier
  1243. to set up a SoundHeader with the combined data).
  1244. - -- 
  1245.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  1246.  I tried to sleep my way to the top
  1247.  But my alarm clock always woke me right up
  1248.  
  1249. +++++++++++++++++++++++++++
  1250.  
  1251. From: zobkiw@world.std.com (Joe Zobkiw)
  1252. Date: 6 Oct 92 12:37:04 GMT
  1253. Organization: The World Public Access UNIX, Brookline, MA
  1254.  
  1255. << If you can get that 4-voice-harmony XCMD to work under 6.0.7, Lawrence,
  1256. a lot of people in the music-education biz would be very grateful.  :-)
  1257. >>
  1258.  
  1259. I wrote an XCMD called PlayChord about 3 years ago that is still available
  1260. on America Online and other places. The latest version on AOL is 1.5.1. It 
  1261. uses the square-wave synth if memory serves and will play up to 4 notes
  1262. simultaneously using any of a number of waveforms (you can even create your
  1263. own, however, they are limited to 256 'steps' per waveform).
  1264.  
  1265. This was originally written under 6.0.5 with THINK Pascal at the time
  1266. and seems to even work fine on my Radius Rocket under 7.0.1! Now _that_
  1267. is truly portable code ;)
  1268.  
  1269. If anyone is interested I'd be glad totry and dig up the source although
  1270. I probably won't be proud of it anymore!
  1271.  
  1272. Check out the XCMD if any of you get a chance and drop me a line telling
  1273. me your thoughts.
  1274.  
  1275.  
  1276. - -- 
  1277. - -------------------------------------------------------------
  1278. joe zobkiw         zobkiw@world.std.com        aol: aflzobkiw
  1279.  
  1280. macintosh.midi.synthesis.c.oop.asm.communications.graphics...
  1281.  
  1282. +++++++++++++++++++++++++++
  1283.  
  1284. From: johnsd2@rs6219.ecs.rpi.edu (Daniel Norman Johnson)
  1285. Organization: Rensselaer Polytechnic Institute, Troy, NY.
  1286. Date: Tue, 6 Oct 1992 20:06:12 GMT
  1287.  
  1288. In article <1992Oct6.124941.16821@hobbes.kzoo.edu>, k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  1289. |> johnsd2@rpi.edu writes:
  1290. |> >Jamie R. McCarthy writes:
  1291. |> >> I was going to suggest using a custom double-buffering routine, but I've
  1292. |> >> never done it myself so I can't give advice.  I'd try that before
  1293. |> >> calling up MacDTS though.
  1294. |> >
  1295. |> >Waitaminute. I thot double buffering was a trick you could do
  1296. |> >to play direct from disk... if not, what is it?
  1297. |> 
  1298. |> To quote IM VI 22-72: 
  1299. [deletia- and he does, too]
  1300. |> 
  1301. |> Double buffering will allow you to play sounds back-to-back,
  1302. |> continuously.  You can get the sounds directly from disk if that's what
  1303. |> your doubleback procedure does;  or, you can synthesize them, read them
  1304. |> from RAM, whatever.
  1305. |> 
  1306. |> The initial question (I think?!) was about playing some sounds
  1307. |> back-to-back.  Double-buffering will let you do that too (though, if you
  1308. |> have the RAM, and you don't mind BlockMove()ing it around, it's easier
  1309. |> to set up a SoundHeader with the combined data).
  1310.  
  1311. Well, actually it had to do with playing sound asynchronously. They
  1312. are never played completely back to back (it doesnt play while
  1313. loading the next sound) and may be played with hours between the sounds.
  1314.  
  1315. - -- 
  1316.             - Dan Johnson
  1317. And God said "Jeeze, this is dull"... and it *WAS* dull. Genesis 0:0
  1318.  
  1319. These opinions have had all identifiying marks removed, and are untraceable.
  1320. You'll never know whose they are.
  1321.  
  1322. ---------------------------
  1323.  
  1324. End of C.S.M.P. Digest
  1325. **********************
  1326.